{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "load tokenizer\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/liyaze/anaconda3/envs/longchain/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly.  To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
      "  return self.fget.__get__(instance, owner)()\n"
     ]
    }
   ],
   "source": [
    "from transformers import AutoModelForCausalLM, AutoTokenizer\n",
    "from transformers.generation import GenerationConfig\n",
    "import torch\n",
    "torch.manual_seed(1234)\n",
    "# 请注意：分词器默认行为已更改为默认关闭特殊token攻击防护。\n",
    "print('load tokenizer')\n",
    "tokenizer = AutoTokenizer.from_pretrained(\"THUDM/LongAlign-13B-64k\", trust_remote_code=True)\n",
    "model = AutoModelForCausalLM.from_pretrained('THUDM/LongAlign-13B-64k', device_map=\"cuda\", trust_remote_code=True)\n",
    "model = model.eval()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "longchain",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
